<div class="container">

        <h1 id="pkg-overview">package parse</h1>

        <p><code>import "text/template/parse"</code>

        </p><p>
Package parse builds parse trees for templates as defined by text/template
and html/template. Clients should use those packages to construct templates
rather than this one, which provides shared internal data structures not
intended for general use.</p>


        
  


        
        

        

        

        
        
          
        

        
        


<p><a href="https://github.com/golang/go/blob/master/src/text/template/parse/lex.go">lex.go</a> <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go">node.go</a> <a href="https://github.com/golang/go/blob/master/src/text/template/parse/parse.go">parse.go</a> </p>

        
        

        
        

        
        
        
          <h2 data-kind="f" id="IsEmptyTree">func <a href="https://github.com/golang/go/blob/master/src/text/template/parse/parse.go#L253" title="View Source">IsEmptyTree</a>  </h2>
          <p>
IsEmptyTree reports whether this tree (node) is empty of everything but space.
</p>

          
  

        
          <h2 data-kind="f" id="Parse">func <a href="https://github.com/golang/go/blob/master/src/text/template/parse/parse.go#L51" title="View Source">Parse</a>  </h2>
          <p>
Parse returns a map from template name to parse.Tree, created by parsing the
templates described in the argument string. The top-level template will be
given the specified name. If an error is encountered, parsing stops and an
empty map is returned with the error.
</p>

          
  

        

        
        

        
          <h2 data-kind="t" id="ActionNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L207" title="View Source">ActionNode</a>  </h2>
          <p>
ActionNode holds an action (something bounded by delimiters).
Control actions have their own nodes; ActionNode represents simple
ones such as field evaluations and parenthesized pipelines.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="ActionNode.Copy">func (*ActionNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L228" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="ActionNode.String">func (*ActionNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L219" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="BoolNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L489" title="View Source">BoolNode</a>  </h2>
          <p>
BoolNode holds a boolean constant.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="BoolNode.Copy">func (*BoolNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L511" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="BoolNode.String">func (*BoolNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L500" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="BranchNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L728" title="View Source">BranchNode</a>  </h2>
          <p>
BranchNode is the common representation of if, range, and with.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="BranchNode.Copy">func (*BranchNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L760" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="BranchNode.String">func (*BranchNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L738" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="ChainNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L445" title="View Source">ChainNode</a>  </h2>
          <p>
ChainNode holds a term followed by a chain of field accesses (identifier starting with '.').
The names may be chained ('.x.y').
The periods are dropped from each ident.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="ChainNode.Add">func (*ChainNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L458" title="View Source">Add</a>  </h3>
            <p>
Add adds the named field (which should start with a period) to the end of the chain.
</p>

            
  

          
            <h3 data-kind="m" id="ChainNode.Copy">func (*ChainNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L484" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="ChainNode.String">func (*ChainNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L469" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="CommandNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L234" title="View Source">CommandNode</a>  </h2>
          <p>
CommandNode holds a command (a pipeline inside an evaluating action).
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="CommandNode.Copy">func (*CommandNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L268" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="CommandNode.String">func (*CommandNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L249" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="DotNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L353" title="View Source">DotNode</a>  </h2>
          <p>
DotNode holds the special identifier '.'.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="DotNode.Copy">func (*DotNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L378" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="DotNode.String">func (*DotNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L370" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="DotNode.Type">func (*DotNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L363" title="View Source">Type</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="FieldNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L415" title="View Source">FieldNode</a>  </h2>
          <p>
FieldNode holds a field (identifier starting with '.').
The names may be chained ('.x.y').
The period is dropped from each ident.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="FieldNode.Copy">func (*FieldNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L438" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="FieldNode.String">func (*FieldNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L426" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="IdentifierNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L280" title="View Source">IdentifierNode</a>  </h2>
          <p>
IdentifierNode holds an identifier.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="NewIdentifier">func <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L288" title="View Source">NewIdentifier</a>  </h3>
            <p>
NewIdentifier returns a new IdentifierNode with the given identifier name.
</p>

            
  

          

          
            <h3 data-kind="m" id="IdentifierNode.Copy">func (*IdentifierNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L316" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="IdentifierNode.SetPos">func (*IdentifierNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L295" title="View Source">SetPos</a>  </h3>
            <p>
SetPos sets the position. NewIdentifier is a public method so we can't modify its signature.
Chained for convenience.
TODO: fix one day?
</p>

            
  

          
            <h3 data-kind="m" id="IdentifierNode.SetTree">func (*IdentifierNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L303" title="View Source">SetTree</a>  </h3>
            <p>
SetTree sets the parent tree for the node. NewIdentifier is a public method so we can't modify its signature.
Chained for convenience.
TODO: fix one day?
</p>

            
  

          
            <h3 data-kind="m" id="IdentifierNode.String">func (*IdentifierNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L308" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="IfNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L774" title="View Source">IfNode</a>  </h2>
          <p>
IfNode represents an {{if}} action and its commands.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="IfNode.Copy">func (*IfNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L782" title="View Source">Copy</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="ListNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L77" title="View Source">ListNode</a>  </h2>
          <p>
ListNode holds a sequence of nodes.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="ListNode.Copy">func (*ListNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L115" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="ListNode.CopyList">func (*ListNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L104" title="View Source">CopyList</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="ListNode.String">func (*ListNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L96" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="NilNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L383" title="View Source">NilNode</a>  </h2>
          <p>
NilNode holds the special identifier 'nil' representing an untyped nil constant.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="NilNode.Copy">func (*NilNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L408" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="NilNode.String">func (*NilNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L400" title="View Source">String</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="NilNode.Type">func (*NilNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L393" title="View Source">Type</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Node">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L21" title="View Source">Node</a>  </h2>
          <p>
A Node is an element in the parse tree. The interface is trivial.
The interface contains an unexported method so that only
types local to this package can satisfy it.
</p>

          
          
          
  


          

          
        
          <h2 data-kind="t" id="NodeType">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L35" title="View Source">NodeType</a>  </h2>
          <p>
NodeType identifies the type of a parse tree node.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="NodeType.Type">func (NodeType) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L47" title="View Source">Type</a>  </h3>
            <p>
Type returns itself and provides an easy default implementation
for embedding in a Node. Embedded in all non-trivial Nodes.
</p>

            
  

          
        
          <h2 data-kind="t" id="NumberNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L518" title="View Source">NumberNode</a>  </h2>
          <p>
NumberNode holds a number: signed or unsigned integer, float, or complex.
The value is parsed and stored under all the types that can represent the value.
This simulates in a small amount of code the behavior of Go's ideal constants.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="NumberNode.Copy">func (*NumberNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L644" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="NumberNode.String">func (*NumberNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L636" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="PipeNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L144" title="View Source">PipeNode</a>  </h2>
          <p>
PipeNode holds a pipeline with optional declaration
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="PipeNode.Copy">func (*PipeNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L200" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="PipeNode.CopyPipe">func (*PipeNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L185" title="View Source">CopyPipe</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="PipeNode.String">func (*PipeNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L161" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Pos">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L39" title="View Source">Pos</a>  </h2>
          <p>
Pos represents a byte position in the original input text from which
this template was parsed.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="Pos.Position">func (Pos) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L41" title="View Source">Position</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="RangeNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L787" title="View Source">RangeNode</a>  </h2>
          <p>
RangeNode represents a {{range}} action and its commands.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="RangeNode.Copy">func (*RangeNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L795" title="View Source">Copy</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="StringNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L651" title="View Source">StringNode</a>  </h2>
          <p>
StringNode holds a string constant. The value has been "unquoted".
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="StringNode.Copy">func (*StringNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L671" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="StringNode.String">func (*StringNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L663" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="TemplateNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L813" title="View Source">TemplateNode</a>  </h2>
          <p>
TemplateNode represents a {{template}} action.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="TemplateNode.Copy">func (*TemplateNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L837" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="TemplateNode.String">func (*TemplateNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L826" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="TextNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L120" title="View Source">TextNode</a>  </h2>
          <p>
TextNode holds plain text.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="TextNode.Copy">func (*TextNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L139" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="TextNode.String">func (*TextNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L131" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Tree">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/parse.go#L20" title="View Source">Tree</a>  </h2>
          <p>
Tree is the representation of a single parsed template.
</p>

          
          
          
  


          
            <h3 data-kind="f" id="New">func <a href="https://github.com/golang/go/blob/master/src/text/template/parse/parse.go#L125" title="View Source">New</a>  </h3>
            <p>
New allocates a new parse tree with the given name.
</p>

            
  

          

          
            <h3 data-kind="m" id="Tree.Copy">func (*Tree) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/parse.go#L35" title="View Source">Copy</a>  </h3>
            <p>
Copy returns a copy of the Tree. Any parsing state is discarded.
</p>

            
  

          
            <h3 data-kind="m" id="Tree.ErrorContext">func (*Tree) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/parse.go#L135" title="View Source">ErrorContext</a>  </h3>
            <p>
ErrorContext returns a textual representation of the location of the node in the input text.
The receiver is only used when the node does not have a pointer to the tree inside,
which can occur in old code.
</p>

            
  

          
            <h3 data-kind="m" id="Tree.Parse">func (*Tree) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/parse.go#L229" title="View Source">Parse</a>  </h3>
            <p>
Parse parses the template definition string to construct a representation of
the template for execution. If either action delimiter string is empty, the
default ("{{" or "}}") is used. Embedded template definitions are added to
the treeSet map.
</p>

            
  

          
        
          <h2 data-kind="t" id="VariableNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L322" title="View Source">VariableNode</a>  </h2>
          <p>
VariableNode holds a list of variable names, possibly with chained field
accesses. The dollar sign is part of the (first) name.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="VariableNode.Copy">func (*VariableNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L348" title="View Source">Copy</a>  </h3>
            
            
  

          
            <h3 data-kind="m" id="VariableNode.String">func (*VariableNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L333" title="View Source">String</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="WithNode">type <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L800" title="View Source">WithNode</a>  </h2>
          <p>
WithNode represents a {{with}} action and its commands.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="WithNode.Copy">func (*WithNode) <a href="https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L808" title="View Source">Copy</a>  </h3>
            
            
  
<div class="clearfix" id="x-footer">
  <div class="container">
    <a href="http://studygolang.com/" target="_blank">Go语言中文网</a>
    <span class="text-muted">|</span> <a href="http://golang.org/" target="_blank">Go Language</a>
    <span class="pull-right"><a href="#">Back to top</a></span>
  </div>
</div>
<script src="../assets/jquery-2.0.3.min.js"></script>
<script src="../assets/bootstrap.min.js"></script>
<script src="../assets/site.js"></script>


</div>